#set(seoTitle="找回密码")
#@layout()
#define main()
<!-- 使用带有 authCode 值的链接更新密码，填写新密码 -->
<div class="col" style="margin-bottom: 20px;">
 	<div class="jf-panel" style="min-height: 400px;">
		<div class="jf-panel-header" style="margin-top:50px;">
			<h1 class="jf-login-title text-center">更新密码</h1>
		</div>
	 	
		<div class="jf-panel-body mt15" style="min-width: 500px;margin:30px auto; text-align:center;">
			<!-- 内容区域  start-->
			<input id="authCode" type="hidden" value="#(authCode)">
			<input id="newPassword" type="password" placeholder="填写新密码">
			<input id="submit_btn" type="button" value="更新密码">
			<!-- 内容区域  end-->
		</div>
	</div>
</div>

#end

#define css()
<style type="text/css">
	#newPassword, #submit_btn {
		display: inline-block;
	}
	#newPassword {
		width:250px;
		height: 32px;
		font-size: 16px;
		margin-right:30px;
	}
	
</style>
#end

#define js()
	<script type="text/javascript" src="/assets/layer/layer/layer.js"></script>
	
	<script type="text/javascript">
		$(document).ready(function() {
			$("#submit_btn").bind("click", doRetrievePassword);
		});
		
		function doRetrievePassword() {
			$.ajax("/login/doRetrievePassword", {
				type: "POST"
				, cache: false
				, dataType: "json"
				, data: { newPassword:  $("#newPassword").val(), authCode:  $("#authCode").val() }
				, beforeSend: function() {
					$("#submit_btn").attr("disabled", true);
				}
				, success: function(ret) {
					layer.msg(ret.msg, {
								shift: ret.state == "ok" ? 0 : 6
								, shade: 0.3
								, time: 0
								, offset: "175px"
								, closeBtn: 1
								, shadeClose: false
								,maxWidth: "1000"
							}, function () {
								if (ret.state == "ok") {
									location.href = "/login";
								} else {
									$("#submit_btn").attr("disabled", false);
								}
							}
					);
				}
			});
		}
	</script>
#end